package com.fatdetection.demo.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;



public class TimeUtil {

    //获取当前时间(String)
   /* public static Date getCurrentTime(){
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date=sdf.format(new Date());

        return date;
    }*/

    //将生日字符串转换为java.sql.Date(yyyy-MM-dd)
    public static Date getSqlDate(String birth) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = sdf.parse(birth);
        return date;
    }

    public static String getFormatDate(Date date){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm;ss");
        String format = sdf.format(date);
        return format;
    }

}
